package pl.edu.agh.mgr.hotel.ws.client;

import javax.xml.ws.BindingProvider;

import com.sun.xml.ws.client.BindingProviderProperties;

import pl.edu.agh.mgr.hotel.ws.client.utility.IWSClient;

public class WSClient5 extends IWSClient {

	private final String wsAddress = "http://localhost:8081/HotelWS/services/DataService5Port";

	@Override
	public DataResponse getHotelData(DataRequest dataRequest) {

		DataService5Service ss = new DataService5Service();
		DataService5 port = ss.getDataService5Port();

		BindingProvider provider = (BindingProvider) port;
		provider.getRequestContext().put(
				BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsAddress);
		provider.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 60 * 1000 * 30);
		provider.getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 60 * 1000 * 30);

		return port.getHotelData(dataRequest);
	}
	
	@Override
	public String getWsAddress() {
		return wsAddress;
	}
}
